+function($){
  var dialogContent = '<form id="shopupdateForm" method="post"><ul>'+
      '<input type="hidden" name="shopid" id="shopid">'+
      '<li><laber class="list-laber">店名：</laber><input name="shopname" id="shopname" class="list-input"></li>'+
      '<li><laber class="list-laber">老板娘：</laber><input name="shopboss" id="shopboss" class="list-input"></li>'+
      '<li><laber class="list-laber">联系电话：</laber><input name="shoptel" id="shoptel" class="list-input"></li>'+
      '<li><laber class="list-laber">合作品牌：</laber><input name="shopbrand" id="shopbrand" class="list-input"></li>'+
      '<li><laber class="list-laber">其他公司品牌：</laber><input name="shopotherbrand" id="shopotherbrand" class="list-input"></li>'+
      '<li><laber class="list-laber">店内信息：</laber><textarea name="shopinfo" class="list-textarea" id="shopinfo" rows="4" cols="34"></textarea></li>'+
      '<li><laber class="list-laber">收货人：</laber><input name="shopconsignee" id="shopconsignee" class="list-input"></li>'+
      '<li><laber class="list-laber">收货人电话：</laber><input name="shopctel" id="shopctel" class="list-input"></li>'+
      '<li><laber class="list-laber">地址：</laber><input name="shopaddr" id="shopaddr" class="list-input"></li>'+
      '<div class="dialog-button"><button class="btn btn-sm btn-primary" id="shopUpdate">修　改</button></div>'+
      '</ul></form>';
  //弹窗
  var mdialog = function($this){
    var d = dialog({
      title:'修改店铺信息',
      content: dialogContent,
      width:'450px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(dialoginit($this));
  }
  var dialoginit = function($this){
    var $pare = $this.parent();
    $('#shopid').val($pare.prevAll('.J_shopid').text());
    $('#shopname').val($pare.prevAll('.J_shopname').text());
    $('#shopboss').val($pare.prevAll('.J_shopboss').text());
    $('#shoptel').val($pare.prevAll('.J_shoptel').text());
    $('#shopbrand').val($pare.prevAll('.J_shopbrand').text());
    $('#shopotherbrand').val($pare.prevAll('.J_shopotherbrand').text());
    $('#shopinfo').text($pare.prevAll('.J_shopinfo').text());
    $('#shopconsignee').val($pare.prevAll('.J_shopconsignee').text());
    $('#shopctel').val($pare.prevAll('.J_shopctel').text());
    $('#shopaddr').val($pare.prevAll('.J_shopaddr').text());
  }
  $('body').on('click', '.J_dialogUpdate', function() {
    mdialog($(this));
  });
  $('body').on('click', '#shopUpdate', function() {
    var postdata = $('#shopupdateForm').serialize();
    var flag=true;
    $('.list-input,.list-textarea').each(function(index, el) {
      if($(this).val()==''){
        $(this).addClass('none');
        flag=false;
      }
    });
    if(flag==false){
      alert('请将信息补充完整');
      return false;
    }
    $.post('/shop/shop_update_go', postdata, function(data) {
      if(data==1){
        alert('修改成功');
        window.location.reload();
      }
    });
    return false;
  });
}(jQuery);
